package com.campuscrowdsourcing.server.controller;

import com.campuscrowdsourcing.server.annotation.Log;
import com.campuscrowdsourcing.server.common.enums.Action;
import com.campuscrowdsourcing.server.domain.model.AjaxResult;
import com.campuscrowdsourcing.server.utils.PuzzleCaptcha;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.InputStream;

/**
 * @author XinYuan Zhao
 * @since 2023/3/14
 */
@RestController
@RequestMapping("/api/test")
public class TestController {


    @Log(title = "test-log", action = Action.SELECT)
    @GetMapping("/test")
    public AjaxResult test(MultipartFile file){
        try{
            InputStream image = file.getInputStream();
            PuzzleCaptcha puzzleCaptcha = new PuzzleCaptcha(image);
            System.out.println(puzzleCaptcha.toString());
            image.close();
        }catch (Exception e){

        }
        return AjaxResult.success("你好");
    }
}
